home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / program / greed.zip / SAVEPRE.CMD < prev    next >
OS/2 REXX Batch file  |  1997-04-01  |  3KB  |  68 lines

  1. /* REXX *********************************************/
  2. /*                                                  */
  3. /* Program name: SAVEPRE                            */
  4. /* Function    : Save current installation - an     */
  5. /*               example for the pre-install exit   */
  6. /*                                                  */
  7. /* Syntax      : Call from the INSTALL.DAT via:     */
  8. /*    START_REXX_BY_START_INSTALL=SAVEPRE dest_path */
  9. /*                                                  */
  10. /* Changes     :                                    */
  11. /*                                                  */
  12. /* Made use of GREED.  21 May 1996 / 19:50:29   JRK */
  13. /****************************************************/
  14.  
  15. Parse Arg destPath
  16. /*-------------(Write lines into file)--------------*/
  17. filename    = destPath'\install.log'
  18. rc = LineOut( filename, 'Destination Directory:' destPath)
  19.  
  20. /*==============(Exception handling)================*/
  21. Signal On Failure Name CLEARUP
  22. Signal On Halt    Name CLEARUP
  23. Signal On Syntax  Name CLEARUP
  24.  
  25. Call On NOTREADY
  26.  
  27. /*==========(Initialize RexxUtil support)===========*/
  28. If RxFuncQuery('SysLoadFuncs') Then Do
  29.   Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  30.   Call SysLoadFuncs
  31. End /* If RxFuncQuery... */
  32.  
  33. /* delRC = SysFileDelete( destPath'\greed.ini' ) */
  34. /*--------------(Make directory)---------------*/
  35. directory = destPath||'\SAVEPREV'
  36. rc = LineOut( filename, 'Save Directory:' directory )
  37. rc = SysMkDir( directory )
  38. if rc = 0 | rc = 5 then do
  39.   ret = LineOut( filename, 'Make Save Directory RC='rc )
  40.   rc = LineOut( filename, "Save" destPath||"\*.*" directory"\" )
  41.   rc = SysFileTree( destPath||"\*.*", fileList, 'FO', '**---' )
  42.   /*-------------(Delete an application)--------------*/
  43.   appl    = 'RACF Callable Services'       /* Application name */
  44.   result = SysIni( destPath||"\TSOISPF.FNC", appl, 'DELETE:' ) 
  45.   appl    = 'User'                         /* Application name */
  46.   result = SysIni( destPath||"\TSOISPF.FNC", appl, 'DELETE:' )
  47.   Do i = 1 To fileList.0
  48.     name  = FileSpec( "Name", fileList.i )  /* FILENAME.EXT */
  49.     If Translate(name) \= 'INSTALL.LOG' Then Do
  50.       delFile = directory'\'name
  51.       rc = SysDestroyObject( delFile )
  52.       rc = SysCopyObject( fileList.i, directory )
  53.     End
  54.   End
  55.   rc = LineOut( filename, 'Save Previous Installation RC='rc )
  56. End
  57. Else ret = LineOut( filename, 'Make Save Directory RC='rc )
  58. /*----------(Set command for file system)-----------*/
  59. status = Stream( filename, 'C', 'Close' )
  60.  
  61. /*================(End this program)================*/
  62. Exit
  63.  
  64. CLEARUP:
  65. NOTREADY:
  66.   rc = LineOut( filename, 'Signal on error in the SavePrev exit' )
  67. Exit
  68.